#ifndef CREATEMYMSG_H
#define CREATEMYMSG_H

#include <cstring>
#include <iostream>
#include <string>
#include <cstring>
#include <time.h>
#include <map>
//用我的格式创建传输字符串格式
enum MsgType {REQ_LOGIN, RSP_LOGIN, REQ_REGIST, RSP_REGIST, MESSAGE, REQ_HEARTB, RSP_HEARTB};
const int UserNameSize = 30;
const int ContentSize = 200;
struct TransMsg{
    MsgType msg_type;
    char msg_from[UserNameSize];
    char msg_to[UserNameSize];
    char msg_content[ContentSize];
};

void CreateReqLoginMsg(TransMsg &trans_msg, const char *from, const char* password);

//正文内容有三种:成功,失败密码错误,失败用户已登录;
void CreateRspLoginMsg(TransMsg &trans_msg, const char * t, const char * content);

void CreateReqRegistMsg(TransMsg &trans_msg, const char * from, const char * password);

//正文内容有两种:成功,失败用户已存在;
void CreateRspRegistMsg(TransMsg &trans_msg, const char * t, const char * content);

//正文内容为发送的内容;
void CreateMessageMsg(TransMsg &trans_msg, const char * from, const char * t, const char * content);

void CreateReqHeartbMsg(TransMsg &trans_msg, const char * from);

void CreateRspHeartbMsg(TransMsg &trans_msg, const char * to,const char * content);

void SplitRspHeartbMsgContent(std::map<std::string, int> &a, std::string content);

void ShowTranslateMessage(const TransMsg& msg);
#endif // CREATEMYMSG_H
